import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
// @ts-ignore
import eslintPlugin from 'vite-plugin-eslint'
import stylelitPlugin from 'vite-plugin-stylelint'
import path from 'path'

function _resolve(dir: string) {
	return path.resolve(__dirname, dir)
}

// https://vitejs.dev/config/
export default defineConfig({
	plugins: [vue(), vueJsx(), eslintPlugin(), stylelitPlugin()],
	resolve: {
		alias: {
			'@': _resolve('src'),
		},
	},
	css: {
		preprocessorOptions: {
			// scss 全局变量配置
			scss: {
				javascriptEnabled: true,
				additionalData: '@import "./src/assets/css/variable.scss";',
			},
		},
	},
})
